package com.gem.netty.message;

import com.gem.netty.delay.Heart;
import com.gem.netty.entity.ClientContent;
import io.netty.channel.Channel;

/**
 * @description: 重连,由前端在刷新页面等相关操作的时候发送心跳
 * @Author: Xhy
 * @gitee: https://gitee.com/XhyQAQ
 * @copyright: B站: https://space.bilibili.com/152686439
 * @CreateTime: 2023-07-05 10:17
 */
public class HearMessage implements Message {

    @Override
    public void handler(ClientContent content) {
        final Channel channel = content.getCtx().channel();
        final String ip = channel.localAddress().toString();
        // 获取用户ip,尝试重新连接
        Heart.getInstance().reconnect(ip);
    }
}
